﻿
<!--#include file="admin/Includes/constants.asp"-->
<!--#include file="admin/Includes/validate.asp"-->
<%
Dim aData, rCount, nRows, hasData, Image
Dim fkCountry, fYear, fkSeason, kDesigner, Permission, SortBy, SortOrder
Dim fCount1, SubCatName, HpAltText, uSubCatName, uHpAltText
Dim CurPgNum, TotalMatches, TotalPages, TotalSets, CurPgSet, SetLBound, SetUBound
Dim PgActiveFont, PgActiveLink_o, PgActiveLink_c, j, aClass, tdClass
Dim SubCatID,Kw,SeasonID

dim refid 
refid = request("refid")
if refid <> "" then
	strSQL = "{CALL a_Ref_add ("&refid&")}"		
	exec(strsql)
end if
Kw=request("search")
'Default CurPgNum
If Request("cp") = "" Then
	CurPgNum = "1"
Else
	CurPgNum = Cint(Request("cp"))
End If

If request("mcid") <> "" Then
	MainCatID = request("mcid")
Else
	MainCatID="1"
End If
If request("scid") <> "" Then
	SubCatID = request("scid")
Else
	Select Case MainCatID
	Case "1"
		SubCatID = "1"
	Case "5"
		SubCatID = "10"
	Case "3"
		SubCatID = "23"
	End Select
End If

'Thoi trang mcid=1,4
fYear = request("fy")
SeasonID = request("fs")
'Sort
SortBy = request("sb")
SortOrder = request("so")
'Registerred users only
Permission = request("Permission")

strSQL = "{CALL a_listing_v3 ('"& MainCatID &"', '"&SubCatID&"', '"&fkCountry&"', '"&fYear&"', '"&fkSeason&"', '"&Permission&"', '"&SortBy&"', '"&SortOrder&"', "&CurPgNum&",'"& Kw &"')}"	
exec(strsql)

	If Not RS Is Nothing Then
	If Not RS.EOF Then
		aData = RS.getrows
		nRows = Ubound(aData,2)	
		hasData=True	
		
	End If
		Set RS=RS.NextRecordSet
	End If
	If Not RS Is Nothing Then
	If Not RS.EOF Then		
		'Paging Totals
		TotalMatches 	= Cint(RS(0))
		TotalPages 		= Cint(RS(1))	
		TotalSets		= Cint(RS(2))	
		CurPgSet 		= Cint(RS(3))
		PageSetSize 	= Cint(RS(4))
		SetLBound  		= Cint(RS(5))
		SetUBound 	 	= Cint(RS(6))
		HpAltText		= RS(7)
		uHpAltText		= RS(8)
	End If
	End If	
	
	Set RS = Nothing
	Set cmd = Nothing
	objConn.Close
	Set objConn = Nothing
	
	If HpAltText <> "" Then
		SubCatName=Replace(HpAltText," ","-")		
	End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<Meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title><%= HpAltText%></title>
	<Meta http-equiv=" content-language" content ="vi">
	<Meta name="Robots" content="noindex,nofollow">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> 
	<link rel="icon" href="favicon.ico" type="image/x-icon"> 
	<link rel="STYLESHEET" type="text/css" href="system/styles.css">
</head>
<body>
<div id="container">
<div id="bt2"><img src="hinh-thoi-trang/bg_top.gif" width="1049" height="20"></div>
<div id="tp">
<table border="0" cellpadding="0" cellspacing="0" width="990" align="center">	
	<!--#include file="system/top.asp" -->
	<tr bgcolor="#6b5a60">
		<td width="160" style="height:1px;"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td>
		<td width="522" valign="top" rowspan="2">
		<!--body content-->		
			<!--cover-->		
		<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#B6A8AD">	
			<form action="listing.asp?cp=<%=CurPgNum%>&mcid=<%=MainCatID%>&scid=<%=SubCatID%>&ckid=<%=ckid%>" method="post">			
			<tr><td colspan="1" style="padding-left:13px;padding-top:3px;"><img src="hinh-thoi-trang/<%= SubCatName %>-hp.gif" alt="<%= HpAltText %>" width="400" height="40"></td></tr>				
			
			<% If MainCatID="1" or MainCatID="3" Then %>
			<!--Filter-->				
			<tr>				
				<td valign=top>
				<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#C0A79E">						
				<tr><td bgcolor="#E5DFE1" width="98%"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<tr>
					<td style="padding-left:12px;">															
							<table border="0" cellpadding="1" cellspacing="0">		
							<tr>
								<% If MainCatID=1 or MainCatID=4  Then %>
								<td class="fTitle">Năm</td>
								<td class="fTitle">Mùa</td>	
								<% ElseIf MainCatID=3 Then %>
								<td class="fTitle">Quốc gia</td>	
								<% End If %>
								<td>&nbsp;</td>								
							</tr>
							<tr>	
								<% If MainCatID=1 or MainCatID=4  Then %>																
								<td><select name="fy" class="ftext">
										<option value="">Xem hết</option>
										<%For fCount1= 0 to 1%>
										<option value="<%=strYear+fCount1%>" <%If strComp(fYear,strYear+fCount1)=0 Then%>SELECTED<%End If%>><%=strYear+fCount1%></option>							
										<%Next%>	
									</select>
								</td>	
								<td><select name="fs" class="ftext">
										<option value="">Xem hết</option>
										<%For fCount1= 0 to ubound(arSeasonVN)%>
										<option value="<%=arSeasonEN(fCount1)%>" <%If strComp(fkSeason,arSeasonEN(fCount1))=0 Then%>SELECTED<%End If%> ><%=arSeasonVN(fCount1)%></option>							
									<%Next%>	
									</select>
								</td>										
								<% End If %>
								<td><input type="submit" value="GIỚI HẠN" class="btnGo"></td>																			
							</tr>															
							</table>						
					</td>						
				</tr>
				<tr><td><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="10" border="0"></td></tr>			
				</table>	
				</td>
			</tr>			
			</form>		
			<!--/Filter-->
			<% End If %>
			<tr bgcolor="#000000"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>
			<tr><td height="24" align="right"><div><img src="hinh-thoi-trang/ico_email.gif" alt="Gởi trang này" width="16" height="16" align="absmiddle"><a href="emailFriend.asp?dt=1&aid=<%= SubCatID %>&mcid=<%= MainCatID %>&ckid=<%=ckid%>" class="Command" style="margin:0 15 0 5;">Gởi trang này</a><% If SubCatID>0 Then %><img src="hinh-thoi-trang/ico_save.gif" alt="Lưu trang này" width="16" height="16" align="absmiddle"><a href="user_fav_add.asp?a=add&dt=1&fid=<%= SubCatID %>&mcid=<%= MainCatID %>&ckid=<%=ckid%>" class="Command" style="margin:0 13 0 3;">Lưu mục này</a><% End If %></div></td></tr>
			
			<tr bgcolor="#E5DFE1"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>	
						
			<!--Product Listings-->
				<% 	
				Dim c_ColPerRow, c_StartCel, c_EndCel, c_nFillCels, c_isRowEnd, c_DataTotal, c_Count, c_arrData
				Dim tdcolor				
				If hasData Then 					
				'Assign variables
				c_ColPerRow = 3
				c_DataTotal = nRows
				c_Count = rCount											
				'system-calculations----------------------------------------------
				If (c_DataTotal+1) Mod c_ColPerRow > 0 Then
					c_EndCel = (Int(((c_DataTotal+1)/c_ColPerRow))+1)*c_ColPerRow-1
				Else
					c_EndCel = c_DataTotal
				End If						
					c_nFillCels = c_EndCel - (c_DataTotal+1)
				'system-calculations----------------------------------------------						
				%>
				<!--system header-->
				<tr>					
					<td>
					<table border="0" cellpadding="0" cellspacing="1" width="100%" bgcolor="#B6A8AD">		
						<!--top border line-->	
						<tr>
				<!--/system header-->					
						<% 	
						tdcolor = "bgcolor=""#F7F6BD"""
						For c_Count = 0 To c_EndCel 							
							'system--------------------------------
							If ((c_Count+1) Mod c_ColPerRow)=0 Then
								c_isRowEnd = True
							End If
							'system--------------------------------	
							If ((c_Count+1) Mod 3)=0 Then
								tdcolor = "bgcolor=""#F7F6BD"""
							End If							
							'Write data Start
							If c_Count <= c_DataTotal Then 'Real Data
								Image = Replace(aData(2,c_Count)," ","-") & "-l" & aData(0,c_Count) & "-" & aData(3,c_Count)%>								
								<td valign="top" <%= tdcolor %> class="lsTD"><h5 style="font-weight:bold">
									<a href="detail.asp?aid=<%= aData(0,c_Count) %>&ckid=<%=ckid%>" class="lsTitle2"><img src="hinh-anh-nguoi-mau/<%= Image %>.jpg" width="150" height="150" border="0" vspace="7">
									<%= aData(1,c_Count)%></a>
									</h5>					
								</td>								
							<%	If 	tdcolor = "bgcolor=""#F7F6BD""" Then
									tdcolor = "bgcolor=""#F7F6BD"""
								Else
									tdcolor = "bgcolor=""#F7F6BD"""
								End If							
							Else 'Fill Cells
								If ((c_Count+1) Mod 3)=0 Then
									tdcolor = "bgcolor=""#F7F6BD"""
								End If
								response.write "<td " & tdcolor & "><img src='hinh-thoi-trang/de_clear.gif' width='104' height='55' border='0'></td>" & vbcrlf	
								If 	tdcolor = "bgcolor=""#F7F6BD""" Then
									tdcolor = "bgcolor=""#F7F6BD"""
								Else
									tdcolor = "bgcolor=""#F7F6BD"""
								End If								
							End If
							'Write data End							
							'system-------------------------------
							If c_isRowEnd Then							
								response.write "</tr>" & vbcrlf		
								If c_Count < c_EndCel Then
									response.write "<tr>" & vbcrlf	
								End If								
								c_isRowEnd = False
							End If								
							'system-------------------------------							
							Next %>							
				<!--system footer-->	
						</tr>
					</table>
					</td>
				</tr>
				<!--/system footer-->					
				<% 	End If		%>
			<!--/Product Listing-->	
			<tr>
				<td valign="top">	
				<table cellpadding="0" cellspacing="0" width="100%" border="0">			
				<!--Paging -->
				<% If TotalPages > 0 Then %>					
				<tr bgcolor="#FFFFFF"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>
				<tr><td><img src="hinh-thoi-trang/de_clear.gif" width="1" height="3" border="0"></td></tr>
				<tr>								
					<td colspan="3" class="paging" style="padding-left:12">Trang <%= CurPgNum %>/<%= TotalPages %></td>
					<td class="paging"><%= TotalMatches %> bài tổng cộng</td>
					<td colspan="5" align="right" style="padding-right:5px;">
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<% If CurPgSet >  1 Then%>
								<td><a href="listing.asp?cp=<%=CurPgNum-PageSetSize%>&mcid=<%=MainCatID%>&scid=<%=SubCatID%>&fy=<%=fYear%>&fs=<%=fkSeason%>&sb=<%=SortBy%>&so=<%=SortOrder%>&ckid=<%=ckid%>"><img src="hinh-thoi-trang/nav_previousset_on.gif" width="28" height="17" border="0"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_previousset_off.gif" width="28" height="17" border="0"></td>
								<% End If %>								
								<% If CurPgNum > 1 Then %>
								<td><a href="listing.asp?cp=<%= CurPgNum - 1%>&mcid=<%=MainCatID%>&scid=<%=SubCatID%>&fy=<%=fYear%>&fs=<%=fkSeason%>&sb=<%=SortBy%>&so=<%=SortOrder%>&ckid=<%=ckid%>"><img src="hinh-thoi-trang/nav_previouspage_on.gif" width="28" height="17" border="0" hspace="3"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_previouspage_off.gif" width="28" height="17" border="0" hspace="3"></td>
								<% End If %>								
								<%		For j = SetLBound To SetUBound													
											If j > TotalPages Then 'Case off
												tdClass = "class='pagingOff'" 
												aClass = ""
												PgActiveLink_o = ""
												PgActiveLink_c = ""
											Else 'Case on
												If j = CurPgNum Then 'Case on and selected		
													tdClass = "class='pagingSelected'"	
													aClass = "class='pagingSelected'"														
												Else 'Case on only no selected
													aClass = "class='pagingOn'"	
													tdClass = ""
												End If
												PgActiveLink_o = "<a href='listing.asp?cp=" & j & "&mcid="&MainCatID&"&scid="&SubCatID&"&fy="&fYear&"&fs="&fkSeason&"&sb="&SortBy&"&so="&SortOrder &"&ckid=" & ckid & "' " & aClass & ">"
												PgActiveLink_c = "</a>"
											End If														
								%>
										<td width="10%" align="center" valign="middle" <%= tdClass %>><%= PgActiveLink_o %><%= j %><%= PgActiveLink_c %></td>												
								<%		Next %>								
								<% If CurPgNum <  TotalPages Then%>
								<td><a href="listing.asp?cp=<%=CurPgNum + 1%>&mcid=<%=MainCatID%>&scid=<%=SubCatID%>&fy=<%=fYear%>&fs=<%=fkSeason%>&sb=<%=SortBy%>&so=<%=SortOrder%>&ckid=<%=ckid%>"><img src="hinh-thoi-trang/nav_nextpage_on.gif" width="28" height="17" border="0" hspace="3"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_nextpage_off.gif" width="28" height="17" border="0" hspace="3"></td>
								<% End If %>
								
								<% If CurPgSet <  TotalSets AND (CurPgNum+Cint(PageSetSize)) <= TotalPages Then%>
								<td><a href="listing.asp?cp=<%= CurPgNum + PageSetSize %>&mcid=<%=MainCatID%>&scid=<%=SubCatID%>&fy=<%=fYear%>&fs=<%=fkSeason%>&sb=<%=SortBy%>&so=<%=SortOrder%>"><img src="hinh-thoi-trang/nav_nextset_on.gif" width="28" height="17" border="0"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_nextset_off.gif" width="28" height="17" border="0"></td>
								<% End If %>
								
							</tr>
						</table>
					</td>
				</tr>	
				<tr><td><img src="hinh-thoi-trang/de_clear.gif" width="1" height="3" border="0"></td></tr>
				<tr bgcolor="#000000"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>							
				<% End If %>		
				</table>		
				<!--/paging-->
				</td>
			</tr>
			<tr><td height="24" align="right"><div><img src="hinh-thoi-trang/ico_email.gif" alt="Gởi trang này" width="16" height="16" align="absmiddle"><a href="emailFriend.asp?dt=1&aid=<%= SubCatID %>&mcid=<%= MainCatID %>&ckid=<%=ckid%>" class="Command" style="margin:0 15 0 5;">Gởi trang này</a><% If SubCatID>0 Then %><img src="hinh-thoi-trang/ico_save.gif" alt="Lưu trang này" width="16" height="16" align="absmiddle"><a href="user_fav_add.asp?a=add&dt=1&fid=<%= SubCatID %>&mcid=<%= MainCatID %>&ckid=<%=ckid%>" class="Command" style="margin:0 13 0 3;">Lưu mục này</a><% End If %></div></td></tr>
		</table>
			<!--/text-->		
		<!--/body content-->
		</td>
		<td width="308" style="height:1px"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td>
	</tr>
	<!--main body-->
	<tr bgcolor="#ffffff">
		<td bgcolor="#000000" width="160" valign="top">
			<!--#include file="system/left.asp" -->
		</td>
		<!--missing 1 TD because of Rowspan-->
		<td bgcolor="#614B00" width="308" valign="top">
			<table border="0" cellpadding="0" cellspacing="0" width="308" align="right">
				<tr bgcolor="#000000"><td colspan="2"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<form action="listing.asp?ckid=<%=ckid%>" method="post">
				<tr bgcolor="#8D0045">
					<td width="154" valign="top" height="33" ><input type="text" name="search" value="Tìm kiếm" size="22" class="txtSearch"></td>
					<td width="154" valign="top" style="padding-top:7px;padding-left:3px;"><input type="submit" name="go" value="TÌM" class="btnGo"></td>
				</tr>
				</form>
				<tr bgcolor="#000000"><td colspan="2"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<!--Ads Starts-->
				<tr><td align="center" colspan="2"><img src="hinh-quang-cao/neimanmarcus350x250.jpg" alt="" width="300" height="250" border="0"></td></tr>
				<!--Ads Ends-->
			</table>
		</td>
	</tr>
	<!--/main body-->
	<!--bottom-->
	<!--#include file="system/bottom.asp" -->
</table>
</div>
<div id="bt2"><img src="hinh-thoi-trang/bg_bottom.gif" width="1049" height="20"></div>
</div>
</body>
</html>
